package com.hsc.yalebao.tabMine;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.PopupWindow.OnDismissListener;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.google.gson.Gson;
import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
import com.handmark.pulltorefresh.library.PullToRefreshBase.State;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.handmark.pulltorefresh.library.extras.SoundPullEventListener;
import com.hsc.yalebao.adapter.GetchildUserListAdapter;
import com.hsc.yalebao.base.ActivityStack;
import com.hsc.yalebao.base.BaseActivity;
import com.hsc.yalebao.base.CustomApplication;
import com.hsc.yalebao.base.MainActivity;
import com.hsc.yalebao.http.AppConstants;
import com.hsc.yalebao.http.RequestNet;
import com.hsc.yalebao.model.GetchildUserListBean;
import com.hsc.yalebao.model.GetchildUserListBeanModel;
import com.hsc.yalebao.model.UserBaseBean;
import com.hsc.yalebao.tools.UiUtil;
import com.hsc.yalebao.weight.LogUtils;
import com.zhy.http.okhttp.callback.StringCallback;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import okhttp3.Call;

public class LookDownUserActivity extends BaseActivity
{
  private static Context context;
  private int Mmonth;
  private String TAG = "LookDownUserActivity";
  private GetchildUserListAdapter adapter;
  private String[] bankname;
  private Calendar calendar;
  private View emptyView;
  private View emptyView1;
  private EditText et_month;
  private EditText et_year;
  private ImageView img_xiala_month;
  private ImageView img_xiala_year;
  private ImageView iv_pic;
  private ImageView iv_title_right;
  private PullToRefreshListView mPullRefreshListView;
  private int mYear;
  private int memberid;
  private String mmonth1 = "全部";
  View.OnClickListener onClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      switch (paramAnonymousView.getId())
      {
      case 2131099704:
      default:
        return;
      case 2131099699:
        CustomApplication.app.finishActivity(LookDownUserActivity.this);
        return;
      case 2131099882:
        LookDownUserActivity.this.showyearPopwindow();
        return;
      case 2131099885:
      }
      LookDownUserActivity.this.showmonthPopwindow();
    }
  };
  PopupWindow popupWindownian;
  PopupWindow popupWindowsyue;
  private ArrayList<GetchildUserListBeanModel> result = new ArrayList();
  private RelativeLayout rl_month;
  private RelativeLayout rl_year;
  private TextView tv_tishi;
  private TextView tv_tishi1;
  private String yearStr = "2016";

  private void GetchildUserList()
  {
    if (CustomApplication.app.userBaseBean != null)
      this.memberid = CustomApplication.app.userBaseBean.getMemberid();
    HashMap localHashMap = new HashMap();
    localHashMap.put("memberid", this.memberid);
    if ("全部".equals(this.mmonth1))
      localHashMap.put("month", "0");
    while (true)
    {
      localHashMap.put("year", this.yearStr);
      LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GET_GETCHILDUSERLIST);
      showLoadingDialog();
      RequestNet.get(context, AppConstants.URL_GET_GETCHILDUSERLIST, localHashMap, new StringCallback()
      {
        public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
        {
          LookDownUserActivity.this.dismissLoadingDialog();
          LogUtils.e(LookDownUserActivity.this.TAG, "获取失败,获取代理商下直接推荐用户列表:" + paramAnonymousException);
        }

        public void onResponse(String paramAnonymousString)
        {
          LookDownUserActivity.this.dismissLoadingDialog();
          LookDownUserActivity.this.mPullRefreshListView.onRefreshComplete();
          LogUtils.d(LookDownUserActivity.this.TAG, "result:" + paramAnonymousString);
          if (UiUtil.IsValueEmpty(paramAnonymousString))
          {
            LogUtils.d(LookDownUserActivity.this.TAG, "result:" + paramAnonymousString);
            LookDownUserActivity.this.mPullRefreshListView.setEmptyView(LookDownUserActivity.this.emptyView1);
          }
          GetchildUserListBean localGetchildUserListBean;
          do
          {
            return;
            Gson localGson = new Gson();
            try
            {
              localGetchildUserListBean = (GetchildUserListBean)localGson.fromJson(paramAnonymousString, GetchildUserListBean.class);
              if (localGetchildUserListBean == null)
              {
                LookDownUserActivity.this.mPullRefreshListView.setEmptyView(LookDownUserActivity.this.emptyView1);
                LogUtils.e(LookDownUserActivity.this.TAG, "getchildUserListBean == null");
                return;
              }
            }
            catch (Exception localException)
            {
              while (true)
              {
                localException.printStackTrace();
                localGetchildUserListBean = null;
              }
              if (localGetchildUserListBean.getFlag() == 0)
              {
                LookDownUserActivity.this.mPullRefreshListView.setEmptyView(LookDownUserActivity.this.emptyView);
                LogUtils.e(LookDownUserActivity.this.TAG, "getchildUserListBean.getFlag() ==0");
                return;
              }
              if (localGetchildUserListBean.getFlag() == -2)
              {
                LookDownUserActivity.this.showDownWireDialog();
                return;
              }
              if (localGetchildUserListBean.getFlag() == -3)
              {
                LookDownUserActivity.this.ShowFengjinDialog();
                return;
              }
              if (localGetchildUserListBean.getFlag() == -4)
              {
                LookDownUserActivity.activityStack.backToMain(MainActivity.class, LookDownUserActivity.context);
                return;
              }
            }
          }
          while (localGetchildUserListBean.getFlag() != 1);
          if (localGetchildUserListBean.getResult() == null)
          {
            LogUtils.e(LookDownUserActivity.this.TAG, "getchildUserListBean.getResult() == null");
            return;
          }
          LookDownUserActivity.this.result.clear();
          LookDownUserActivity.this.result.addAll(localGetchildUserListBean.getResult());
          if ((LookDownUserActivity.this.result == null) || (LookDownUserActivity.this.result.size() == 0))
          {
            LookDownUserActivity.this.tv_tishi1.setVisibility(8);
            LookDownUserActivity.this.mPullRefreshListView.setEmptyView(LookDownUserActivity.this.emptyView);
            LogUtils.e(LookDownUserActivity.this.TAG, "result == null || result.size() == 0");
          }
          LookDownUserActivity.this.adapter.setData(LookDownUserActivity.this.result);
          LookDownUserActivity.this.adapter.notifyDataSetChanged();
        }
      });
      return;
      localHashMap.put("month", this.mmonth1);
    }
  }

  private void init()
  {
    this.et_year = ((EditText)findViewById(2131099883));
    this.et_month = ((EditText)findViewById(2131099886));
    this.et_month.setInputType(0);
    this.et_year.setInputType(0);
    this.rl_year = ((RelativeLayout)findViewById(2131099882));
    this.rl_year.setOnClickListener(this.onClickListener);
    this.rl_month = ((RelativeLayout)findViewById(2131099885));
    this.rl_month.setOnClickListener(this.onClickListener);
    this.img_xiala_year = ((ImageView)findViewById(2131099884));
    this.img_xiala_month = ((ImageView)findViewById(2131099887));
    this.emptyView1 = LayoutInflater.from(context).inflate(2130903139, null);
    this.emptyView = LayoutInflater.from(context).inflate(2130903140, null);
    this.mPullRefreshListView = ((PullToRefreshListView)findViewById(2131099717));
    this.iv_pic = ((ImageView)this.emptyView.findViewById(2131100146));
    this.tv_tishi = ((TextView)this.emptyView.findViewById(2131100053));
    this.tv_tishi1 = ((TextView)this.emptyView1.findViewById(2131100053));
    this.tv_tishi1.setText("获取中...");
    this.mPullRefreshListView.setEmptyView(this.emptyView1);
    this.mPullRefreshListView.setMode(PullToRefreshBase.Mode.BOTH);
    SoundPullEventListener localSoundPullEventListener = new SoundPullEventListener(this);
    localSoundPullEventListener.addSoundEvent(PullToRefreshBase.State.PULL_TO_REFRESH, 2131034114);
    localSoundPullEventListener.addSoundEvent(PullToRefreshBase.State.RESET, 2131034116);
    localSoundPullEventListener.addSoundEvent(PullToRefreshBase.State.REFRESHING, 2131034115);
    if (this.adapter == null)
    {
      this.adapter = new GetchildUserListAdapter(context, this.result);
      this.mPullRefreshListView.setAdapter(this.adapter);
    }
    this.adapter.notifyDataSetChanged();
  }

  @SuppressLint({"NewApi"})
  @TargetApi(12)
  private void showmonthPopwindow()
  {
    this.img_xiala_month.setImageResource(2130837882);
    View localView = LayoutInflater.from(context).inflate(2130903173, null);
    final PopupWindow localPopupWindow = new PopupWindow(localView, this.rl_month.getWidth(), 400, true);
    ListView localListView = (ListView)localView.findViewById(2131100233);
    final String[] arrayOfString = { "全部", "1 月", "2 月", "3 月", "4 月", "5 月", "6 月", "7 月", "8 月", "9 月", "10 月", "11 月", "12 月" };
    localListView.setAdapter(new ArrayAdapter(context, 2130903047, arrayOfString));
    localListView.setOnItemClickListener(new AdapterView.OnItemClickListener()
    {
      private String replaceAll;

      public void onItemClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
      {
        try
        {
          LookDownUserActivity.this.et_month.setText(arrayOfString[paramAnonymousInt]);
          if (!"全部".equals(arrayOfString[paramAnonymousInt]))
            this.replaceAll = arrayOfString[paramAnonymousInt].replaceAll("月", "");
          LookDownUserActivity.this.mmonth1 = this.replaceAll;
          LookDownUserActivity.this.img_xiala_month.setImageResource(2130837881);
          LookDownUserActivity.this.GetchildUserList();
          localPopupWindow.dismiss();
          return;
        }
        catch (Exception localException)
        {
          localException.printStackTrace();
        }
      }
    });
    localPopupWindow.setOutsideTouchable(true);
    localPopupWindow.setFocusable(true);
    localPopupWindow.setBackgroundDrawable(context.getResources().getDrawable(2130838170));
    localPopupWindow.showAsDropDown(this.et_month, 0, 0);
    localPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener()
    {
      public void onDismiss()
      {
      }
    });
  }

  @SuppressLint({"NewApi"})
  @TargetApi(12)
  private void showyearPopwindow()
  {
    this.img_xiala_year.setImageResource(2130837882);
    View localView = LayoutInflater.from(context).inflate(2130903173, null);
    final PopupWindow localPopupWindow = new PopupWindow(localView, this.rl_year.getWidth(), 2 * this.rl_year.getHeight(), true);
    ListView localListView = (ListView)localView.findViewById(2131100233);
    localListView.setAdapter(new ArrayAdapter(context, 2130903047, this.bankname));
    localListView.setOnItemClickListener(new AdapterView.OnItemClickListener()
    {
      public void onItemClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
      {
        try
        {
          LookDownUserActivity.this.et_year.setText(LookDownUserActivity.this.bankname[paramAnonymousInt] + "年");
          LookDownUserActivity.this.img_xiala_year.setImageResource(2130837881);
          LookDownUserActivity.this.yearStr = LookDownUserActivity.this.bankname[paramAnonymousInt];
          LookDownUserActivity.this.GetchildUserList();
          localPopupWindow.dismiss();
          return;
        }
        catch (Exception localException)
        {
          localException.printStackTrace();
        }
      }
    });
    localPopupWindow.setOutsideTouchable(true);
    localPopupWindow.setFocusable(true);
    localPopupWindow.setBackgroundDrawable(context.getResources().getDrawable(2130838170));
    localPopupWindow.showAsDropDown(this.et_year, 0, 0);
  }

  @TargetApi(19)
  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903065);
    CustomApplication.app.addActivity(this);
    context = this;
    this.calendar = Calendar.getInstance();
    setTitle(8, 0, 2130837809, "用户信息", 0, 8, 8, 0, true);
    init();
    int i = this.calendar.get(1);
    String[] arrayOfString = new String[2];
    arrayOfString[0] = (i - 1);
    arrayOfString[1] = i;
    this.bankname = arrayOfString;
    this.yearStr = this.bankname[0];
  }

  protected void onResume()
  {
    super.onResume();
    GetchildUserList();
  }

  @SuppressLint({"NewApi"})
  public void setTitle(int paramInt1, int paramInt2, int paramInt3, String paramString, int paramInt4, int paramInt5, int paramInt6, int paramInt7, boolean paramBoolean)
  {
    View localView = findViewById(2131099716);
    if (paramBoolean)
      localView.setVisibility(0);
    while (true)
    {
      ((TextView)localView.findViewById(2131099701)).setText(paramString);
      ((TextView)localView.findViewById(2131099700)).setVisibility(paramInt1);
      ImageView localImageView = (ImageView)localView.findViewById(2131099699);
      localImageView.setVisibility(paramInt2);
      localImageView.setOnClickListener(this.onClickListener);
      localImageView.setImageResource(paramInt3);
      TextView localTextView = (TextView)localView.findViewById(2131099702);
      localTextView.setVisibility(paramInt5);
      localTextView.setOnClickListener(this.onClickListener);
      this.iv_title_right = ((ImageView)localView.findViewById(2131099704));
      this.iv_title_right.setVisibility(paramInt6);
      this.iv_title_right.setOnClickListener(this.onClickListener);
      this.iv_title_right.setImageResource(paramInt7);
      return;
      localView.setVisibility(8);
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tabMine.LookDownUserActivity
 * JD-Core Version:    0.6.2
 */